package com.gjy.pulsar.disruptor;

import com.gjy.pulsar.util.PulsarUtil;
import org.apache.pulsar.client.api.Producer;
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Schema;

import java.util.UUID;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-08-02 10:09:57
 */
public class DisruptorProduce {

    public static void main(String[] args) throws PulsarClientException {
        PulsarClient client = PulsarClient.builder()
                .serviceUrl(PulsarUtil.URL)
                .build();

        // persistent://public/default/my-topic
        Producer<String> producer = client.newProducer(Schema.STRING).topic("persistent://public/default/orders").create();
        producer.newMessage().value(UUID.randomUUID().toString()).send();
        producer.close();
        client.close();
    }
}
